package com.daniel.cloud.controller;

import com.daniel.cloud.order.entity.Order;
import com.daniel.cloud.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/order")
public class OrderController {

    @Autowired
    private OrderService orderService;

    @GetMapping("{orderId}")
    public Order queryOrderByUserId(@PathVariable("orderId") Long orderId,@RequestHeader(value = "goal", required = false) String goal) {
        System.out.println(goal);
        // 根据id查询订单并返回
        return orderService.queryOrderById(orderId);
    }
    @GetMapping("/testBalanced")
    public String testBalanced() {
        return orderService.testBalanced();
    }
}